<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新品有戏后台管理</title>
    <link href="__CSS__/boot.css" rel="stylesheet">
    <link href="__STATIC__/layui/css/layui.css" rel="stylesheet">
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/layer/layer.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <style>
        th{
            text-align: center;
            vertical-align: middle!important;
        }
    </style>
</head>
<body>
{include file="base/header" /}
<div style="width: 500px;margin: 0 auto;margin-top: 150px;">
    <form class="layui-form" action="" method="post">
        <input type="hidden" name="id" value="{$result.id}"/>
        <div class="layui-form-item">
            <label class="layui-form-label">联系人</label>
            <div class="layui-input-block">
                <input type="text" name="linkman"  value="{$result.linkman}" required  lay-verify="required" placeholder="联系人" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">电话</label>
            <div class="layui-input-block">
                <input type="text" name="telephone" required  value="{$result.telephone}" lay-verify="required" placeholder="联系电话" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">地址</label>
            <div class="layui-input-block">
                <textarea id="address" name="address" placeholder="地址" class="layui-textarea">{$result.address}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <!--<button class="layui-btn" >立即采购</button>-->
                <button type="button" onclick="sub()" class="btn btn-primary">立即修改</button>
                <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
            </div>
        </div>
    </form>
    <script>
        //Demo
        layui.use('form', function(){
            //var form = layui.form;

            //监听提交
//            form.on('submit(formDemo)', function(data){
//                layer.msg(JSON.stringify(data.field));
//                return false;
//            });
        });
    </script>
    <script>
        function sub() {
            var linkman = $("input[name=linkman]").val();
            var telephone = $("input[name=telephone]").val();
            var address = $("#address").val();
            var id = $("input[name=id]").val()
            if(!linkman){
                layer.alert('请填写联系人');
                return;
            }
            if(!telephone){
                layer.alert('请填写练习电话');
                return;
            }
            if(!address){
                layer.alert('请填写地址')
                return;
            }
            $.ajax({
                url:"{:url('index/shop/update')}",
                type:"post",
                data:'linkman='+linkman+'&telephone='+telephone+'&address='+address+'&id='+id,
                dataType:"json",
                success:function (data) {
                    if(data.success){
                        layer.alert(data.success);
                    }
                    if(data.error){
                        layer.alert(data.error);
                    }
                }
            });
        }
    </script>
</div>

</body>

</html>